package net.zwet.clanworks.resthome.services.news;

import net.zwet.clanworks.resthome.GenericService;
import net.zwet.clanworks.resthome.responses.NewsResponse;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * User: zwet
 * Date: 16-12-13
 * Time: 10:34
 * To change this template use File | Settings | File Templates.
 */
@Path("/api/news")
public class NewsService extends GenericService {
    @GET
    @Produces({
        MediaType.APPLICATION_XML,
        MediaType.APPLICATION_JSON
    })
    @Path("{id}")
    public NewsResponse read(@PathParam("id") int id) {
        NewsResponse news = new NewsResponse();

        news.setId(id);
        news.setTitle("[title]");
        news.setTeaser("[teaser]");
        news.setText("[text]");
        news.setAuthor("[author]");
        news.setCreationDate(new Date());
        news.setPublishingDate(new Date());

        return news;
    }

}
